package com.example.adapter;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.TextView;

import com.example.datlichkham.R;
import com.example.dto.Lichkham;


public class LichKhamAdapter extends ArrayAdapter<Lichkham> {
    LayoutInflater inflater;
    
    ArrayList<Lichkham> arrData;
    
    public LichKhamAdapter(Context conttext, int textViewResourceId,
                           ArrayList<Lichkham> objects) {
        super(conttext, textViewResourceId, objects);
        arrData = objects;
        inflater = (LayoutInflater) conttext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }



    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
    	View row = inflater.inflate(R.layout.listview_rows, parent, false);
        Lichkham lichkham = (Lichkham) arrData.get(position);
        TextView TenBacsi = (TextView) row.findViewById(R.id.tvTenBacsi);
        TenBacsi.setText(lichkham.getTenBacsi());
        TextView TenChuyenkhoa = (TextView) row.findViewById(R.id.tvTenChuyenkhoa);
        TenChuyenkhoa.setText(lichkham.getTenChuyenkhoa());
        TextView Ngay = (TextView) row.findViewById(R.id.tvNgay);
        Ngay.setText(lichkham.getNgay());
        TextView Gio = (TextView) row.findViewById(R.id.tvGio);
        Gio.setText(lichkham.getGio());

        Button btnDatlich = (Button) row.findViewById(R.id.btnDatlich);
        btnDatlich.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
            	
            }
        });

        return row;
    }

    
    
}
